<%@ Page language="c#" Inherits="Dimok.Aspx.Manager.Tracking.Technician_Tracker" CodeFile="Technician_Tracker.aspx.cs" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>TrackingForm</TITLE>
<META name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"><META name="CODE_LANGUAGE" Content="C#"><META name="vs_defaultClientScript" content="JavaScript"><META name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<?XML:NAMESPACE PREFIX="COOL"/>
<?XML:NAMESPACE PREFIX="DIMOK"/>
<?IMPORT namespace="DIMOK" implementation="/include/htc/datagrid.htc">
<LINK rel="stylesheet" type="text/css" href="/CSS/Outlook.css">
<SCRIPT src="/include/common.js"></SCRIPT>
<SCRIPT src="/include/soap.js"></SCRIPT>
<SCRIPT src="/include/XML.js"></SCRIPT>
<SCRIPT src="/include/RDS.js"></SCRIPT>
<SCRIPT src="/include/Events.js"></SCRIPT>
<STYLE>
cool\:tip{behavior: url(/Include/HTC/cooltip_js.htc)}
.cell {BORDER:1 black solid;background-color:white;width:100%;padding:1px}
</STYLE>
</HEAD>
<BODY>
<COOL:TIP id="oTip" avoidmouse="false" DURATION="30"></COOL:TIP>
<TABLE>
	<TR><TD>
<TABLE>
	<TR align="center">
		<TD>Technician</TD>
		<TD>Trackers (<SPAN id="spnTechTrackersCount"></SPAN><SPAN id="spnTechTrackersMax"></SPAN>)</TD>
		<TD></TD>
		<TD></TD>
		<TD>Add</TD>
	</TR>
	<TR>
		<TD><SELECT id="selTechnician" runat="server" style="FONT-FAMILY: Monospace" onchange="TechnicianTrackers(this)" size="8"></SELECT></TD>
		<TD><SELECT id="selTechTrackers" size="8" style="FONT-FAMILY: Monospace" ondblclick="TechnicianTracker_Cancel()"><OPTION>___________</OPTION></SELECT></TD>
		<TD><INPUT type="button" value=" > " onclick="TechnicianTracker_Cancel()"></TD>
		<TD><INPUT type="button" value=" < " onclick="TechnicianTracker_InHands()"></TD>
		<TD align="center">
			<INPUT onkeypress="filterTrackers(this)" style="width:99%" id="txtTrackerFilter">
			<SELECT id="selTrackers" size="7" style="MARGIN-TOP: -2px; FONT-FAMILY: Monospace" ondblclick="TechnicianTracker_InHands()" multiple><OPTION>___________</OPTION></SELECT>
		</TD>
	</TR>
</TABLE>
	</TD></TR><TR><TD>
<TABLE datasrc="#xmlTechCars" id="tblTechCars" style="BEHAVIOR: url(/Include/HTC/TableDataSrc.htc)">
	<THEAD><TR><TH>Car Description</TH><TH>VIN</TH><TH>Dealer</TH><TH>Status</TH></TR></THEAD>
	<TR bgcolor="White" onclick="dialogArguments.opener.document.frames[1].showTrackerRequest(rsField(this,'TrackerRequestID').value)">
		<TD nowrap><SPAN datafld="Description"></SPAN></TD>
		<TD nowrap><SPAN datafld="VIN"></SPAN></TD>
		<TD nowrap><SPAN datafld="Dealer"></SPAN></TD>
		<TD nowrap><SPAN datafld="Status"></SPAN></TD>
	</TR>
</TABLE>
<XML id="xmlTechCars"></XML>
	</TD></TR><TR><TD>
<TABLE datasrc="#xmlTechTrackers" style="BEHAVIOR: url(/include/HTC/rowover_js.htc);ro--light-background:white;ro--shade-background:white" selectable="1">
	<THEAD><TR><TH>Tracker</TH><TH>Status</TH><TH>Date</TH></TR></THEAD>
	<TR style="BACKGROUND-COLOR: white" onclick="dialogArguments.opener.document.frames[1].showTracker(rsField(event.srcElement,'TrackerID'))">
		<TD nowrap title="Click to see tracker info"><SPAN datafld="TrackerID"></SPAN></TD>
		<TD nowrap><SPAN datafld="Status"></SPAN></TD>
		<TD nowrap><SPAN datafld="Date"></SPAN></TD>
	</TR>
</TABLE>
</TD></TR></TABLE>
<XML id="xmlTechTrackers"></XML>
<OBJECT CLASSID="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" ID="rdsTrackers" VIEWASTEXT height="0"></OBJECT>
</BODY>
</HTML>
<SCRIPT language="javascript">
initWS("Common","../Common/Common.asmx");
setTimeout(function(){cropWindow()},100);
var rsTrackers;
function filterTrackers(el){
	if( event )return setTimeout(function(){filterTrackers(el)},100);
	var filter = el.value;
	if( filter.length <= 2 )filter = "";
	rsTrackers.filter = "ID like '"+(filter ? "*"+filter+"*" : "~")+"'";
	fillSelect(rsTrackers,selTrackers,"ID","ID");
}
function refreshTrackers(xmlDS){
	var rsTech = getRSFromDS(xmlDS,"Technician");
	spnTechTrackersMax.innerHTML = parseInt(rsTech("MaxTrackers")) > 0 ? "/"+rsTech("MaxTrackers") : "";
	var rs = getRSFromDS(xmlDS,"TechTrackers");
	fillSelect(rs,selTechTrackers,"TrackerID","TrackerID");
	if( rs && !updateRS(xmlTechTrackers.recordset,rs) ){
		rs.MoveFirst();rs.MovePrevious();xmlTechTrackers.loadXML(getDSFromRS(rs).xml);
	}
	spnTechTrackersCount.innerHTML = (rs||{}).recordCount||0;
	rsTrackers = getRSFromString(getRSFromDS(xmlDS,"Trackers")("AdoString").Value);	selTrackers.length = 0;
	filterTrackers(txtTrackerFilter);
	xmlTechCars.loadXML(getDSFromRS(getRSFromDS(xmlDS,"Cars")).xml);
	setTimeout(function(){cropWindow()},500);
}
function TechnicianTracker_InHands(){
	if( !eval(selTechnician.value) )return alert("Select a technician");
	if( !selTrackers.value )return alert("Select a tracker");
	var ret = WS(CO(getFuncName()),selTechnician.value,getElementValue(selTrackers));
	if( showSOAPError(ret) )return;
	refreshTrackers(ret.value);
}
function TechnicianTracker_Cancel(){
	if( !selTechnician.value )return alert("Select a technician");
	var trackerID = selTechTrackers.value;
	if( !trackerID )return alert("Select a tracker");
	var ret = WS(CO(getFuncName()),selTechnician.value,trackerID);
	if( showSOAPError(ret) )return;
	txtTrackerFilter.value = trackerID;
	refreshTrackers(ret.value);
	fireListRefresh({menuPath:"Tracking ->"});
}

function TechnicianTrackers(sel){
	var ret = WS(CO(),sel.value);
	if( showSOAPError(ret) )return;
	refreshTrackers(ret.value);
}
</SCRIPT>
